package com.loan.common.enums;

import com.loan.common.utils.StringUtils;

public enum UserTypeEnum {
    /**
     * 用户类型
     */
    AGENT("AGENT", "一级代理"),
    SEC_AGENT("SEC_AGENT", "二级代理"),
    USER("USER", "普通用户"),
    ;

    String code;
    String desc;

    UserTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public UserTypeEnum getUserTypeEnum(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (UserTypeEnum typeEnum : UserTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }


}